import pytest
from ..Operation.Invest_Operation import Invest_Operation
from ..Data.Data import Data


class Test_Invest(Invest_Operation):
    da = Data()

    # 执行成功的测试用例
    @pytest.mark.parametrize('name,pwd,buyname,paypwd,expect', da.readExcel(sheetname='基金'))
    def test_invest_1(self, name,pwd,buyname,paypwd,expect):
        driver = self.driver()
        sql=f'select balance from bankcard join user on bankcard.userId=user.id and bankcard.defaultl=1 where user.username="{name}"'
        driver=self.login(name,pwd,driver)
        driver=self.invest(driver,buyname,paypwd)
        result = float(self.GetSuccessResult(sql))
        self.assertResult(result, expect)
